package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.MeetingSign;
import com.yami.shop.dao.MeetingSignMapper;
import com.yami.shop.service.MeetingSignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lgh on 2019/03/27.
 */
@Service
public class MeetingSignServiceImpl extends ServiceImpl<MeetingSignMapper, MeetingSign> implements MeetingSignService {

    @Autowired
    private MeetingSignMapper meetingSignMapper;

    @Override
    @Cacheable(cacheNames = "MeetingSigns", key = "#shopId + ':' + #meetingId")
    public List<MeetingSign> getMeetingSignByShopIdAndMeetingId(Long shopId, Long meetingId) {
        return meetingSignMapper.selectList(new LambdaQueryWrapper<MeetingSign>().eq(MeetingSign::getMeetingId, meetingId).eq(MeetingSign::getShopId, shopId));
    }

    @Override
    public MeetingSign getMeetingSignById(Long meetingSignId) {
        return meetingSignMapper.selectByPrimaryKey(meetingSignId);
    }
}
